package org.emavaj.sanguosha.model.card.equipment.armor;


import org.emavaj.sanguosha.model.card.AbstractCard;
import org.emavaj.sanguosha.model.card.equipment.AbstractEquipmentCard;
import org.emavaj.sanguosha.model.card.resource.Deck;
import org.emavaj.sanguosha.view.gameview.GameFrame;

/**
 * User: DIZEM
 * Time: 11-4-1 下午10:51
 * 
 * eMavaj update 20120916
 */
public abstract class AbstractArmorCard extends AbstractEquipmentCard {

//	private Logger logger = Logger.getLogger(ArmorCard.class);

//	public AbstractArmorCard(String pattern, String number, String name, String description, String filename) {
//		super(pattern, number, name, description, filename);
//	}

	/**
	 * @param attackCard
	 * @return true if cancelled the attack
	 */
	public boolean cancelAttack(AbstractCard attackCard) {

		if (attackCard.getName().equals("杀")
				|| attackCard.getName().equals("万箭齐发")) {

			if (getName().equals("八卦阵")) {
				AbstractCard card = Deck.getInstance().popCard();
				return card.isRed();

			} else if (getName().equals("仁王盾")) {
				return !attackCard.isRed();
			}
		}
		return false;
	}
	
	@Override
	public void runCardEffect(GameFrame client) {
	}

	@Override
	public int getEquipmentType() {
		return AbstractEquipmentCard.TYPE_ARMOR_CARD;
	}
}
